import 'package:json_annotation/json_annotation.dart';

import '../item_style.dart';
import '../line_style.dart';
import '../tooltip.dart';
import 'series.dart';

part 'graph_series.g.dart';

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class Circular {
  var rotateLabel;

  Circular({this.rotateLabel});

  factory Circular.fromJson(Map<String, dynamic> json) =>
      _$CircularFromJson(json);

  Map<String, dynamic> toJson() => _$CircularToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class Force {
  var initLayout;
  var repulsion;
  var gravity;
  var edgeLength;
  var layoutAnimation;
  var friction;

  Force(
      {this.initLayout,
      this.repulsion,
      this.gravity,
      this.edgeLength,
      this.layoutAnimation,
      this.friction});

  factory Force.fromJson(Map<String, dynamic> json) => _$ForceFromJson(json);

  Map<String, dynamic> toJson() => _$ForceToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class GraphEmphasis {
  var scale;
  var focus;
  var blurScope;
  ItemStyle? itemStyle;
  LineStyle? lineStyle;
  SeriesLabel? label;
  SeriesLabel? edgeLabel;

  GraphEmphasis(
      {this.scale,
      this.focus,
      this.blurScope,
      this.itemStyle,
      this.lineStyle,
      this.label,
      this.edgeLabel});

  factory GraphEmphasis.fromJson(Map<String, dynamic> json) =>
      _$GraphEmphasisFromJson(json);

  Map<String, dynamic> toJson() => _$GraphEmphasisToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class GraphBlurSelectEmphasis {
  ItemStyle? itemStyle;
  LineStyle? lineStyle;
  SeriesLabel? label;
  SeriesLabel? edgeLabel;

  GraphBlurSelectEmphasis(
      {this.itemStyle, this.lineStyle, this.label, this.edgeLabel});

  factory GraphBlurSelectEmphasis.fromJson(Map<String, dynamic> json) =>
      _$GraphBlurSelectEmphasisFromJson(json);

  Map<String, dynamic> toJson() => _$GraphBlurSelectEmphasisToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class Category {
  var name;
  var symbol;
  var symbolSize;

  var symbolRotate;
  var symbolKeepAspect;
  var symbolOffset;
  ItemStyle? itemStyle;
  SeriesLabel? label;
  GraphBlurSelectEmphasis? emphasis;
  GraphBlurSelectEmphasis? blur;
  GraphBlurSelectEmphasis? select;

  Category(
      {this.name,
      this.symbol,
      this.symbolSize,
      this.symbolRotate,
      this.symbolKeepAspect,
      this.symbolOffset,
      this.itemStyle,
      this.label,
      this.emphasis,
      this.blur,
      this.select});

  factory Category.fromJson(Map<String, dynamic> json) =>
      _$CategoryFromJson(json);

  Map<String, dynamic> toJson() => _$CategoryToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class GraphData {
  var name;
  var x;
  var y;
  var fixed;
  var value;
  var category;
  var symbol;
  var symbolSize;
  var symbolRotate;
  var symbolKeepAspect;
  var symbolOffset;
  ItemStyle? itemStyle;
  SeriesLabel? label;
  GraphBlurSelectEmphasis? emphasis;
  GraphBlurSelectEmphasis? blur;
  GraphBlurSelectEmphasis? select;
  Tooltip? tooltip;

  GraphData(
      {this.name,
      this.x,
      this.y,
      this.fixed,
      this.value,
      this.category,
      this.symbol,
      this.symbolSize,
      this.symbolRotate,
      this.symbolKeepAspect,
      this.symbolOffset,
      this.itemStyle,
      this.label,
      this.emphasis,
      this.blur,
      this.select,
      this.tooltip});

  factory GraphData.fromJson(Map<String, dynamic> json) =>
      _$GraphDataFromJson(json);

  Map<String, dynamic> toJson() => _$GraphDataToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class GraphLink {
  var source;
  var target;

  var value;

  LineStyle? lineStyle;
  SeriesLabel? label;
  GraphBlurSelectEmphasis? emphasis;
  GraphBlurSelectEmphasis? blur;
  GraphBlurSelectEmphasis? select;
  var symbol;

  var symbolSize;

  var ignoreForceLayout;

  GraphLink(
      {this.source,
      this.target,
      this.value,
      this.lineStyle,
      this.label,
      this.emphasis,
      this.blur,
      this.select,
      this.symbol,
      this.symbolSize,
      this.ignoreForceLayout});

  factory GraphLink.fromJson(Map<String, dynamic> json) =>
      _$GraphLinkFromJson(json);

  Map<String, dynamic> toJson() => _$GraphLinkToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class GraphSeries {
  var type = 'graph';
  var id;
  var name;

  var legendHoverLink;
  var coordinateSystem;
  var xAxisIndex;
  var yAxisIndex;
  var polarIndex;
  var geoIndex;
  var calendarIndex;
  var center;
  var zoom;
  var layout;

  Circular? circular;
  Force? force;

  var roam;
  var nodeScaleRatio;
  var draggable;
  var edgeSymbol;
  var edgeSymbolSize;
  var cursor;

  ItemStyle? itemStyle;

  LineStyle? lineStyle;

  SeriesLabel? label;
  SeriesLabel? edgeLabel;
  LabelLayout? labelLayout;

  GraphEmphasis? emphasis;
  GraphBlurSelectEmphasis? blur;
  GraphBlurSelectEmphasis? select;
  var selectedMode;
  List<Category>? categories;

  var autoCurveness;

  List<GraphData>? data;
  var nodes;
  List<GraphLink>? links;
  var edges;

  MarkPoint? markPoint;
  MarkLine? markLine;
  MarkArea? markArea;

  var zlevel;
  var z;
  var left;
  var top;
  var right;
  var bottom;
  var width;
  var height;
  var silent;
  var animation;
  var animationThreshold;
  var animationDuration;
  var animationEasing;
  var animationDelay;
  var animationDurationUpdate;
  var animationEasingUpdate;
  var animationDelayUpdate;
  Tooltip? tooltip;

  GraphSeries(
      {this.id,
      this.name,
      this.legendHoverLink,
      this.coordinateSystem,
      this.xAxisIndex,
      this.yAxisIndex,
      this.polarIndex,
      this.geoIndex,
      this.calendarIndex,
      this.center,
      this.zoom,
      this.layout,
      this.circular,
      this.force,
      this.roam,
      this.nodeScaleRatio,
      this.draggable,
      this.edgeSymbol,
      this.edgeSymbolSize,
      this.cursor,
      this.itemStyle,
      this.lineStyle,
      this.label,
      this.edgeLabel,
      this.labelLayout,
      this.emphasis,
      this.blur,
      this.select,
      this.selectedMode,
      this.categories,
      this.autoCurveness,
      this.data,
      this.nodes,
      this.links,
      this.edges,
      this.markPoint,
      this.markLine,
      this.markArea,
      this.zlevel,
      this.z,
      this.left,
      this.top,
      this.right,
      this.bottom,
      this.width,
      this.height,
      this.silent,
      this.animation,
      this.animationThreshold,
      this.animationDuration,
      this.animationEasing,
      this.animationDelay,
      this.animationDurationUpdate,
      this.animationEasingUpdate,
      this.animationDelayUpdate,
      this.tooltip});

  factory GraphSeries.fromJson(Map<String, dynamic> json) =>
      _$GraphSeriesFromJson(json);

  Map<String, dynamic> toJson() => _$GraphSeriesToJson(this);
}
